FROM php:7.2-fpm-alpine

RUN set -ex && \
    sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories

RUN apk update upgrade && \
    apk add bash && \
    apk add --no-cache openjdk8

#RUN apk update && \
#    apk add libpng-dev freetype-dev libjpeg-turbo-dev && \
#    docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/  && \
#    docker-php-ext-install -j$(nproc) gd

# RUN sed -i 's/www-data:\/sbin\/nologin/www-data:\/bin\/ash/g'  /etc/passwd && \
#     apk update && \
#     apk add libpng-dev freetype-dev libjpeg-turbo-dev && \
#     docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/  && \
#     docker-php-ext-install -j$(nproc) gd

COPY ./gocron-node /opt/gocron-node

COPY ./shx-gmssl-0.02.jar /opt/shx-gmssl-0.02.jar

RUN chown -R www-data:www-data /opt/gocron-node

RUN chmod +x /opt/gocron-node

EXPOSE 5921

# ENTRYPOINT /opt/gocron-node
#su -s /bin/sh -c "/usr/local/nginx/sbin/nginx"
# CMD [ "su - www-data -s /bin/ash -c /opt/gocron-node" ]
# ENTRYPOINT [ "su - www-data -s /bin/ash -c /opt/gocron-node" ]
# CMD ["sh /opt/a.sh"]

CMD su - www-data -s /bin/ash -c /opt/gocron-node